<div style="font-size: 12px;display: flex;align-items: center;margin-bottom: 6px;
                        margin-top: 8px;">
    固定编码
</div>
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate">
    <input type="text" nz-input [ngModel]='orgItem.value' [disabled]="true" />
</nz-input-group>
<ng-template #addOnAfterTemplate>
    <div style="display: flex;">
        <i class="iconfont icon-settings-3-line" nz-popover [nzPopoverTitle]="titleTemplate"
            [nzPopoverContent]="contentTemplate" [(nzPopoverVisible)]="visible" nzPopoverTrigger="click"></i>
        <nz-divider nzType="vertical"></nz-divider>
        <i class="iconfont icon-add-line" nz-popover [nzPopoverTitle]="autoCodeAddTitle"
            [nzPopoverContent]="autoCodeAddContent" nzPopoverTrigger="click"></i>
    </div>
</ng-template>
<ng-template #titleTemplate>
    <div class="p-5">
        编码设置
    </div>
</ng-template>
<ng-template #contentTemplate>
    <div nz-row class="margin-b">
        <div nz-col nzSpan="6" class="txt-center">
            编码位数
        </div>
        <div nz-col nzSpan="18">
            <nz-input-group [nzAddOnAfter]="numberAfterBit" [nzAddOnBefore]="numberBeforeBit">
                <input type="text" nz-input [(ngModel)]="orgItem.codeBit" [disabled]="true" />
            </nz-input-group>
            <ng-template #numberAfterBit>
                <i class="iconfont icon-add-line" (click)="plusCodeBit(orgItem)"></i>
            </ng-template>
            <ng-template #numberBeforeBit>
                <i class="iconfont icon-subtract-line" (click)="minusCodeBit(orgItem)"></i>
            </ng-template>
        </div>
    </div>

    <div nz-row class="margin-b">
        <div nz-col nzSpan="6" class="txt-center">
            编码起始值
        </div>
        <div nz-col nzSpan="18">
            <!-- <input type="text" nz-input [ngModel]="item.value" (keyup)="settledValueChange($event, item)"/> -->
            <nz-input-number class="full-row" (change)="settledValueChange(orgItem)" [(ngModel)]="orgItem.value"
                [nzMin]="1">
            </nz-input-number>
        </div>
    </div>

    <div nz-row class="margin-b">
        <div nz-col nzSpan="6" class="txt-center">
            编码重置
        </div>
        <div nz-col nzSpan="18">
            <nz-select [(ngModel)]="orgItem.canReset" class="full-row">
                <nz-option [nzValue]="true" nzLabel="是"></nz-option>
                <nz-option [nzValue]="false" nzLabel="否"></nz-option>
            </nz-select>
        </div>
    </div>

    <div nz-row class="margin-b">
        <div nz-col nzSpan="6" class="txt-center">
            自增数值
        </div>
        <div nz-col nzSpan="18">
            <nz-input-group [nzAddOnAfter]="numberAfter" [nzAddOnBefore]="numberBefore">
                <input type="text" nz-input [(ngModel)]="orgItem.incrementSeed" />
            </nz-input-group>
            <ng-template #numberAfter>
                <i class="iconfont icon-add-line" (click)="plusSeed(orgItem)"></i>
            </ng-template>
            <ng-template #numberBefore>
                <i class="iconfont icon-subtract-line" (click)="minusSeed(orgItem)"></i>
            </ng-template>
        </div>
    </div>

    <div nz-row class="margin-b">
        <div nz-col nzSpan="6" class="txt-center">
            重置规则
        </div>
        <div nz-col nzSpan="18">
            <nz-select [(ngModel)]="orgItem.resetRule" class="full-row">
                <nz-option nzValue="year" nzLabel="跨年"></nz-option>
                <nz-option nzValue="quarter" nzLabel="跨季度"></nz-option>
                <nz-option nzValue="month" nzLabel="跨月"></nz-option>
            </nz-select>
        </div>
    </div>

    <div>
        注：重置均是指自然年、季度（3,6,9，12月）、月编码将按照起始值重新开始。
    </div>

    <nz-divider></nz-divider>

    <div class="txt-center-h full-row">
        <button nz-button nzType="primary" (click)="ok()">
            保存
        </button>
    </div>
</ng-template>


<ng-template #autoCodeAddTitle>
    更多操作
</ng-template>
<ng-template #autoCodeAddContent>
    <div class="btn-more">
        <a nz-button nzType="link" (click)="addGroupItem('auto')">
            <i class="iconfont icon-add-circle-line"></i>
            新增共用一个“固定编码”的编码
        </a>
        <a nz-button nzType="link" (click)="addAutoItem('auto')">
            <i class="iconfont icon-add-circle-line"></i>
            新增自定义编码
        </a>
    </div>
</ng-template>